package com.marcjmcd.cop4331;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.media.AudioManager;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;

public class Main extends Activity 
{
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
    	//Code execution begins here
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        //Controls the media volume instead of ringer volume
        setVolumeControlStream(AudioManager.STREAM_MUSIC);
        
        //All menu buttons initialized here
        
        /*
         * SHORTEST PATH 
         * 
         */
        Button b1 = (Button) findViewById(R.id.button1);
        
        b1.setOnClickListener(new OnClickListener() {
			
		public void onClick(View v) 
		{
			Context context = getApplicationContext();
			
			print("Shortest Path Was Clicked");
			startActivity(new Intent(context, Shortest.class));
		}
		});
        
        /*
         * LOCAL ATTRACTIONS
         * 
         */
        Button b2 = (Button) findViewById(R.id.button2);
        
  		b2.setOnClickListener(new OnClickListener() {
  					
  			public void onClick(View v) 
  			{
  				Context context = getApplicationContext();
  				
  				print("Local Attractions Was Clicked");	
  				startActivity(new Intent(context, Attractions.class));
  			}
  		});
        
  		/*
  		 * NAVIGATE HOME
  		 * 
  		 */
        Button b3 = (Button) findViewById(R.id.button3);
      
  		b3.setOnClickListener(new OnClickListener() {
  			
  			public void onClick(View v) 
  			{
  				Context context = getApplicationContext();
  				
  				print("Navigate Home Was Clicked");
  				startActivity(new Intent(context, NavHome.class));
  			}
  		});
        
  		/*
  		 * TTS
  		 * 
  		 */
        Button b4 = (Button) findViewById(R.id.button4);
        
        b4.setOnClickListener(new OnClickListener() {
			
			public void onClick(View v) 
			{
				Context context = getApplicationContext();
				
				print("Text To Speech Was Clicked");
				startActivity(new Intent(context, TextToSpeech.class));
			}
		});
        
      /*
       * Support
       * 
       */
        Button b5 = (Button) findViewById(R.id.button5);
      
      	b5.setOnClickListener(new OnClickListener() {
      			
  			public void onClick(View v) 
  			{
  				Context context = getApplicationContext();
  				print("Support Was Clicked");	
  				
  				//Go to the oops web-site
  				startActivity(new Intent(context, Site.class));
  			}
  		});	
    }
    
    /*
     * print(CharSequence);
     * 
     * A method implemented to print out things to the toast panel.  It takes a CharSequence as a 
     * parameter.
     */
    private void print(CharSequence output)
    {
    	Context context = getApplicationContext();
        int duration = Toast.LENGTH_SHORT;
    	
		Toast toast = Toast.makeText(context, output, duration);
		toast.setGravity(Gravity.BOTTOM, 0, 75);

        toast.show();
    }
}